package com.haha.qqchannelbot.core.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 消息内容拼接
 */
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ContentBuilder {

    /**
     * 消息内容
     */
    private String content;

    /**
     * at的人员id
     * everyone 为 @全部人员
     */
    private String at;

    /**
     * 频道id
     */
    private String channelId;

    /**
     * emoji
     */
    private EmojiEmum emoji;

    public String getContentBuild() {
        StringBuilder contentBuild = new StringBuilder();
        contentBuild.append(this.content);
        if (null != at) {
            contentBuild.append("\n")
                    .append("<@!" + at + ">\u00a0");
        }
        if (null != channelId) {
            contentBuild.append("\n")
                    .append("<#" + channelId + ">\u00a0");
        }
        if (null != emoji) {
            contentBuild.append("\n")
                    .append("<emoji:"+ emoji.getId() + ">\u00a0");
        }
        return contentBuild.toString();
    }
}
